from aioredis import Redis

from common.pkg.bloom_filter_util import SimpleBloomFilter


def _init_bloomfilter(*, bf_key: str = None, bit_size: int = None, hash_count: int = None, redis: Redis = None):
    return SimpleBloomFilter(bf_key=bf_key, bit_size=bit_size, hash_count=hash_count, redis=redis)


def init_tenant_bloomfilter(bf_key: str = "TENANT", bit_size: int = 100000, hash_count: int = 3, redis: Redis = None):
    return _init_bloomfilter(bf_key=bf_key, bit_size=bit_size, hash_count=hash_count, redis=redis)


def init_email_bloomfilter(bf_key: str = "TENANT_EMAIL", bit_size: int = 10000000, hash_count: int = 3, redis: Redis = None):
    return _init_bloomfilter(bf_key=bf_key, bit_size=bit_size, hash_count=hash_count, redis=redis)


def init_mall_bloom_filter(bf_key: str = "MALL", bit_size: int = 10000000, hash_count: int = 3, redis: Redis=None):
    return _init_bloomfilter(bf_key=bf_key, bit_size=bit_size, hash_count=hash_count, redis=redis)
